import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TrackVO, TrackForm, TrackQuery } from '@/api/zntx-app/track/types';

/**
 * 查询股道管理列表
 * @param query
 * @returns {*}
 */

export const listTrack = (query?: TrackQuery): AxiosPromise<TrackVO[]> => {
  return request({
    url: '/zntx-app/track/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询股道管理详细
 * @param id
 */
export const getTrack = (id: string | number): AxiosPromise<TrackVO> => {
  return request({
    url: '/zntx-app/track/' + id,
    method: 'get'
  });
};

/**
 * 新增股道管理
 * @param data
 */
export const addTrack = (data: TrackForm) => {
  return request({
    url: '/zntx-app/track',
    method: 'post',
    data: data
  });
};

/**
 * 修改股道管理
 * @param data
 */
export const updateTrack = (data: TrackForm) => {
  return request({
    url: '/zntx-app/track',
    method: 'put',
    data: data
  });
};

/**
 * 删除股道管理
 * @param id
 */
export const delTrack = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zntx-app/track/' + id,
    method: 'delete'
  });
};
